﻿
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Vehicle.DAL
{
    /// <summary>
    /// Copyright (C) M-Tear团队
    /// 文 件 名：Role.cs
    /// 版    本：v1.00.0000
    /// 创建标识：2009-08-27    Created by 杨光远 V1.00.0000
    /// 功能说明：Role表数据层类（继承于数据层基类)
    /// 注意事项：无
    /// 
    /// 更新记录：
    /// 
    /// </summary>
    public class Role : DAL.Base_DAL, Vehicle.Interface.IRole
    {

        /// <summary>
        /// 绑定页面Repeater控件
        /// </summary>
        /// <param name="DAL">需要绑定的DataList控件</param>
        public void RepeaterBind(Repeater rept, Model.ComponentsInfo m_ComponentsInfo)
        {

            rept.DataSource = GetAllSearch(new Model.ComponentsInfo(m_ComponentsInfo.startIndex, m_ComponentsInfo.endIndex, "Role", m_ComponentsInfo.condition, m_ComponentsInfo.result, "R_ID")).DefaultView;
            rept.DataBind();
        }
        /// <summary>
        /// 绑定页面DropDownList控件
        /// </summary>
        /// <param name="drop">需要绑定的下拉控件</param>
        public void DropDownListBind(DropDownList drop)
        {

            drop.DataSource = GetModel(new Model.ComponentsInfo("Role", "R_ID")).DefaultView;
            drop.DataTextField = "R_Name";//显示的名称
            drop.DataValueField = "R_ID";//数据值
            drop.DataBind();

        }
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="m_RoleInfo">角色实体层</param>
        public void Add(Model.RoleInfo m_RoleInfo)
        {
            string SpName = "Role_ADD";
            object[] _object = new object[] { 0, m_RoleInfo.R_Name, m_RoleInfo.R_Note };
            SqlHelper.ExecuteNonQuery(SpName, _object);
        }
        /// <summary>
        /// 修改角色
        /// </summary>
        /// <param name="m_RoleInfo">角色实体层</param>
        public void Update(Model.RoleInfo m_RoleInfo)
        {
            string SpName = "Role_Update";
            object[] _object = new object[] { 0, m_RoleInfo.R_ID, m_RoleInfo.R_Name, m_RoleInfo.R_Note };
            SqlHelper.ExecuteNonQuery(SpName, _object);
        }
    }
}
